package exemplos;

import br.edu.fvs.principal.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.Toast;

public class ExemploMenu extends Activity {
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.main);
	}

	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		menu.add(0, 0, 0, "Novo");
		menu.add(0, 1, 0, "Salvar");
		menu.add(0, 2, 0, "Excluir");
		return true;
	}
	public boolean onMenuItemSelected(int featureId, MenuItem item){
		switch (item.getItemId()){
		case 0:
			Toast.makeText(this, "Novo!", Toast.LENGTH_SHORT).show();
			break;
		case 1:
			Toast.makeText(this, "Salvar!", Toast.LENGTH_SHORT).show();
			break;
		case 2:
			Toast.makeText(this, "Excluir!", Toast.LENGTH_SHORT).show();
			break;
		}
		return false;
	}
}